package top.bluesword.bean;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeId;
import com.fasterxml.jackson.annotation.JsonTypeInfo;

/**
 * `@JsonSubTypes`多态下反序列化创建具体的子类
 * @author 李林峰
 */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "figureType")
@JsonSubTypes({
    @JsonSubTypes.Type(value = Square.class, name = FigureTypeEnum.SQUARE_NAME),
    @JsonSubTypes.Type(value = Circular.class, name = FigureTypeEnum.CIRCULAR_NAME)
})
public abstract class Figure {

    @SuppressWarnings("unused")
    @JsonTypeId
    abstract public FigureTypeEnum getFigureType();

}
